FatFs - Return Codes

# Return Code of the File Functions

On the FatFs API, most of file functions return common result code as enum type. When a function succeeded, it returns zero, otherwise returns non-zero value that indicates type of error.

FR_OK (0)
  The function succeeded.
FR_DISK_ERR
  An unrecoverable error occured in the lower layer (disk I/O functions).
FR_INT_ERR
  Assertion failed. An insanity is detected in the internal process. One of the following possibilities are suspected.
  - There is any error of the FAT structure on the volume.
  - Work area (file system object, file object or etc...) is broken by stack overflow or any other application. This is the reason in most case.
  - An `FR_DISK_ERR` has occured on the file object.
FR_NOT_READY
  The disk drive cannot work due to incorrect medium removal or disk_initialize function failed.
FR_NO_FILE
  Could not find the file.
FR_NO_PATH
  Could not find the path.
FR_INVALID_NAME
  The given string is invalid as the path name.
FR_DENIED
  The required access was denied due to one of the following reasons:
  - Write mode open against the file with read-only attribute.
  - Deleting the file or directory with read-only attribute.
  - Deleting the non-empty directory or current directory.
  - Reading the file opened without FA_READ flag.
  - Any modification to the file opened without FA_WRITE flag.
  - Could not create the file or directory due to the directory table is full.
  - Could not create the directory due to the volume is full.
FR_EXIST
  Any object that has the same name is already existing.
FR_INVALID_OBJECT
  The given file/directory object structure is invalid.
FR_WRITE_PROTECTED
  Any write mode action against write-protected media.
FR_INVALID_DRIVE
  Invalid drive number is specified. (Related option: _VOLUMES)
FR_NOT_ENABLED
  Work area for the logical drive has not been registered by f_mount function.
FR_NO_FILESYSTEM
  There is no valid FAT volume on the drive.
FR_MKFS_ABORTED
  The f_mkfs function aborted before start in format due to a reason as follows:
  - The disk size is too small.
  - Not allowable cluster size for this disk. This can occure when number of clusters gets near the 0xFF7 and 0xFFF7.
FR_TIMEOUT
  The function canceled due to a timeout of thread-safe control. (Related option: _TIMEOUT)
FR_LOCKED
  The file access is rejected by file sharing control. (Related option: _FS_LOCK)
FR_NOT_ENOUGH_CORE
  Not enough memory for the operation. There is one of the following reasons:
  - Could not allocate a memory for LFN working buffer. (Related option: _USE_LFN)
  - Given table size is insufficient for the required size.
FR_TOO_MANY_OPEN_FILES
  Number of open files has been reached maximum value and no more file can be opened. (Related option: _FS_LOCK)
FR_INVALID_PARAMETER
  The given parameter is invalid or there is any inconsistent.